function sanekey(str) {
    let map = {}
    for (const v of str) {
        map[v] = (map[v] || 0) + 1
    }
    for (let i = 0; i < str.length; i++) {
        if (map[str[i]] == 0) return index
    }
    return -1
}